<template>
	<view>
		<template v-if="!islogin">
			<!-- 登录 -->
			<view class="u-f-ajc">登录仿糗百，体验更多功能</view>
			<!-- 第三方登录 -->
			<other-login></other-login>
			<!-- 账号密码登录 -->
			<view class="u-f-ajc" @tap="toLogin">
				账号密码登录
				<view class="icon iconfont icon-jinru"></view>
			</view>
		</template>
		
		<!-- 登录信息 -->
		<template v-else>
			<home-info :homeinfo="homeinfo"></home-info>
		</template>
		
		<!-- 数据 -->
		<home-data :homedata="homedata"></home-data>
		<!-- 广告位 -->
		<view class="home-adv u-f-ajc">
			<image src="../../static/images/adv.jpg" mode="widthFix" lazy-load></image>
		</view>
		
		<!-- 功能列表 -->
		<block v-for="(oper, index) in operlist" :key="index">
			<home-oper-list :oper="oper"></home-oper-list>
		</block>
	</view>
</template>

<script>
	import homeOperList from '../../components/home/home-oper-list.vue';
	import homeInfo from '../../components/home/home-info.vue';
	import otherLogin from '../../components/home/other-login.vue';
	import homeData from '../../components/home/home-data.vue';
	export default {
		components:{
			homeOperList,
			homeInfo,
			otherLogin,
			homeData
		},
		data() {
			return {
				islogin: true,
				homeinfo: {
					avatar: '../../static/images/avatar/nan2.jpg',
					nickname: '',
					totalnum: 20,
					todaynum: 5
				},
				operlist:[
					{icon:'liulan', name:'浏览历史', color: '#90B4D4',clicktype: '', url: ''},
					{icon:'huiyuanvip', name:'糗百认证', color: '#ff832e',clicktype: '', url: ''},
					{icon:'keyboard2', name:'审核糗事',color: '#96c1d6',clicktype: '', url: ''},
				],
				homedata:[
					{name: '糗事', num: 12},
					{name: '动态', num: 12},
					{name: '评论', num: 12},
					{name: '收藏', num: 12}
				]
			}
		},
		onNavigationBarButtonTap(e) {
			if(e.index === 0){
				uni.navigateTo({
					url: '../user-set/user-set'
				})
			}
		},
		methods: {
			toLogin(){
				uni.navigateTo({
					url: '../login/login'
				})
			}
		}
	}
</script>

<style scoped>
	.home-adv{
		padding: 20upx;
	}
	.home-adv>image{
		width: 100%;
		border-radius: 20upx;
		height: 150upx;
	}
</style>
